<template>
  <div id="member_balance_v2">
    <c-title :hide="false" :text="balanceLang" tolink="detailed"></c-title>
    <div :class="uniacid1 == 6 ? 'background_box' : 'background_box1'" v-if="show"></div>
    <div class="contenbox">
      <!-- 余额 -->
      <template v-if="!name">
        <div class="detail">
          <div class="txt">我的{{ balanceLang }}（元)</div>
          <div class="balance">{{ dataInfo.balance }}</div>
          <!-- 换牛二期-88-新增兑换按钮-开始 -->
          <block v-if="uniacid == '88'">
            <div class="detailBox" v-if="dataInfo.balance_button.length > 0">
              <div
                class="duihuan-niu"
                @click="tourl(item.url)"
                :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'"
                v-for="item in dataInfo.balance_button"
                :key="item.title"
              >
                {{ item.title }}
              </div>
              <!-- <div class="duihuan-niu recharge" v-if="isTixian == 0" @click="gotoIncome">提现</div> -->
              <!-- <div @click="changeJifen" class="duihuan-niu duihuan-bg">兑换</div> -->
            </div>
          </block>
          <!-- 换牛二期-88-新增兑换按钮-结束 -->
          <block v-else>
            <div class="detailBox" v-if="dataInfo.balance_button.length > 0" :class="uniacid == '70' ? 'justify-center' : ''">
              <!-- <div v-if="item.title == '提现' && isTixian == 0" >
              <div
                class="detailBox_btn"
                @click="tourl(item.url)"
                :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'"
                v-for="item in dataInfo.balance_button"
                :key="item.title"
              >
                {{ item.title }}
              </div>
            </div> -->
              <!-- <div
              
              @click="tourl(item.url)"
              
              v-for="item in dataInfo.balance_button"
              :key="item.title"
            >
            {{ item.title }}--{{ isTixian }}
              <div v-if="isTixian == 0 && item.title == '提现'" class="detailBox_btn" :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'">
                {{ item.title }}
              </div>
              <div v-else-if="isTixian == 0 && item.title != '提现'" class="detailBox_btn" :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'">
                {{ item.title }}
              </div>
              
            </div> -->
              <div
                class="detailBox_btn"
                @click="tourl(item.url)"
                :class="item.title == '充值' ? 'recharge' : item.title == '转账' ? 'transfer' : 'withdraw'"
                v-for="item in dataInfo.balance_button"
                :key="item.title"
              >
                {{ item.title }}
              </div>
              <div class="detailBox_btn recharge" v-if="uniacid == '43' || uniacid == '46'" @click="gotoIncome">佣金提现</div>
              <div class="detailBox_btn recharge" v-else-if="isTixian == 0 && uniacid != '60' && uniacid != '70' && uniacid != '89' && uniacid != '121'" @click="gotoIncome">提现</div>
            </div>
          </block>
          <div class="activityTxt" v-if="dataInfo.recharge_activity && dataInfo.recharge_activity.activity">
            充值活动：
            <div class="txt_for" v-for="(item, index) in dataInfo.recharge_activity.activity" :key="index">
              充值满{{ item.enough }}元赠送{{ item.give }}{{ dataInfo.recharge_activity.type == "0" ? "元" : "%" }}{{ index != dataInfo.recharge_activity.activity.length - 1 ? "，" : "" }}
            </div>
          </div>
        </div>
        <div class="balanceDetail" v-if="dataInfo.balance_log.length > 0">
          <div class="title">
            <div class="title_left">{{ balanceLang }}明细</div>
            <div class="title_right" @click="tourl('detailed')">
              查看全部
              <van-icon name="arrow" color="#878787" />
            </div>
          </div>
          <div class="balanceDetail_lis" v-for="(item, index) in dataInfo.balance_log" :key="index">
            <div class="balanceDetail_lis_top">
              <div class="balanceDetail_lis_top_left" v-if="uniacid == '88'">{{ item.service_type == 3 ? `${item.service_type_name}-${item.transfer_member_id}` : item.service_type_name }}</div>
              <div class="balanceDetail_lis_top_left" v-else-if="uniacid == '89'">{{ item.service_type == 3 ? `${item.service_type_name}-${item.transfer_member_tel}` : item.service_type_name }}</div>
              <div class="balanceDetail_lis_top_left" v-else>{{ item.service_type_name }}</div>
              <div class="price">{{ item.type == 1 ? "+" : "" }}{{ item.change_money }}</div>
            </div>
            <div v-if="uniacid == '121'" class="balanceDetail_lis_top" style="margin-top: 0.625rem;text-align: left;">{{ item.remark }}</div>
            <div class="balanceDetail_lis_bottom">
              <div class="time">{{ item.created_at }}</div>
              <div class="balanceTxt">{{ balanceLang }}：{{ item.new_money }}</div>
            </div>
            <div class="balanceDetail_lis_bottom" v-if="item.transfer_member_name != '' && uniacid == '70'">
              <div class="time">{{ item.action_type }}昵称：{{ item.transfer_member_name }}</div>
              <!-- <div class="balanceTxt">{{ balanceLang }}：{{ item.new_money }}</div> -->
            </div>
          </div>
        </div>
        <div class="rests" v-if="dataInfo.other">
          <div class="title">其他功能</div>
          <div class="lis">
            <div class="restslis" @click="transformingLoveV" v-for="(item, index) in dataInfo.other" :key="index">
              <div class="image">
                <img :src="item.img" alt="" />
              </div>
              <div class="txt">转化{{ item.title }}</div>
            </div>
          </div>
        </div>
      </template>
      <!-- 猫崽积分 数据统计-->
      <template v-else>
        <div class="detail">
          <div class="txt">我的{{ balanceLang }}</div>
          <div class="balance" style="margin-top: 0.625rem">{{ dataInfo.point }}</div>
          <div class="detailBox" style="margin-top: 1.4rem">
            <div
              class="detailBox_btn"
              @click="tourlEclogicalPoint(item.url, { status: item.status })"
              :class="item.title == '转让' ? 'recharge' : item.title == '打赏' ? 'transfer' : 'withdraw'"
              v-for="item in dataInfo.point_buttons"
              :key="item.title"
            >
              {{ item.title }}
            </div>
          </div>
        </div>
        <div class="balanceDetail" v-if="dataInfo && dataInfo.point_log">
          <div class="title">
            <div class="title_left">{{ balanceLang }}明细</div>
            <div class="title_right" @click="tourl('ecologicalPointDetailed')">
              查看全部
              <van-icon name="arrow" color="#878787" />
            </div>
          </div>
          <div class="balanceDetail_lis" v-for="(item, index) in dataInfo.point_log" :key="index">
            <div class="balanceDetail_lis_top">
              <div class="balanceDetail_lis_top_left">{{ item.source_name }}</div>
              <div class="price">{{ item.change_type == 1 ? "+" : "-" }}{{ item.amount }}</div>
            </div>
            <div class="balanceDetail_lis_bottom">
              <div class="time">{{ item.created_at }}</div>
              <div class="balanceTxt">剩余:{{ item.present }}</div>
            </div>
          </div>
        </div>
        <div class="rests">
          <div class="title">其他功能</div>
          <div class="lis">
            <div class="restslis" @click="transformingTo(item.id)" v-for="item in nameOther" :key="item.id">
              <div class="image_name">
                <img :src="item.img" alt="" />
              </div>
              <div class="txt">{{ item.title }}</div>
            </div>
          </div>
        </div>
        <div class="dataStatistics">
          <div class="title">数据统计</div>
          <div class="navDateList">
            <div class="lis" :class="Navlis == 'day' ? 'isDay' : ''" @click="tapNav('day')">今日</div>
            <div class="lis" :class="Navlis == 'week' ? 'isDay' : ''" @click="tapNav('week')">本周</div>
            <div class="lis" :class="Navlis == 'month' ? 'isDay' : ''" @click="tapNav('month')">本月</div>
          </div>
          <div class="list">
            <div class="left">平台总资产额</div>
            <div class="right">{{ point_statistics.grand_member_point }}</div>
          </div>
          <div class="list">
            <div class="left">互转额</div>
            <div class="right">{{ point_statistics.cycle_transfer_point }}</div>
          </div>
          <div class="list">
            <div class="left">打赏额</div>
            <div class="right">{{ point_statistics.cycle_reward_point }}</div>
          </div>
          <div class="list">
            <div class="left">让利额</div>
            <div class="right">{{ point_statistics.cycle_tactful_point }}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">发放总数</div>
            <div class="right">{{ point_statistics.grand_airdrop_point }}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">当天空投数量</div>
            <div class="right">{{ point_statistics.today_airdrop_point }}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">剩余待发放数量</div>
            <div class="right">{{ point_statistics.surplus_airdrop_point }}</div>
          </div>
          <div class="list" v-if="Navlis == 'day'">
            <div class="left">当天销毁数量</div>
            <div class="right">{{ point_statistics.today_destroy_point }}</div>
          </div>
          <div class="list">
            <div class="left">销毁总数</div>
            <div class="right">{{ point_statistics.grand_destroy_point }}</div>
          </div>
        </div>
      </template>
    </div>
    <!-- 换牛二期-88-兑换积分弹窗 -->
    <van-popup v-model="duihuanPop" position="center" :overlay="true" closeable round>
      <div class="dui-pop">
        <div class="duihuanPop-title">兑换消费积分</div>
        <div style="width:100%;display: flex;align-items: center;padding: 0 30px;">
          <div style="display: flex;flex: 1;">
            <input class="duihuanPop-input" type="text" disabled v-model="niuJifen" />
          </div>
          <div style="width: 6.625rem;">
            <van-stepper v-model="fenNiuJifen" integer @change="huanniuJifen"/>
          </div>
        </div>
        <div class="duihuanPop-btn" v-if="!isNiuDuiLoadding" @click="duijifen">确定</div>
        <div class="duihuanPop-btn" v-if="isNiuDuiLoadding">确定</div>
      </div>
    </van-popup>
    <!-- 换牛二期-88-兑换一次确认弹窗 -->
    <van-popup v-model="duihuanFirstPop" position="center" :overlay="true" round :close-on-click-overlay="false">
      <div class="dui-pop1">
        <div class="duihuanPop-title">恭喜您，获得换牛生态金牛</div>
        <div style="width:100%;height: 59px;display: flex;align-items: center;padding: 0 30px;flex-direction: column;">
          <!-- <div>请输入您的换牛会员ID</div> -->
          <div style="display: flex;flex: 1;">
            <input class="duihuanPop-input1" placeholder="请输入您的换牛会员ID" type="number" v-model="niuUid" />
          </div>
        </div>
        <div class="" style="height: 50px;display: flex;width: 100%;border-top: 1px solid #eaeaea;">
          <div @click="cancelDuihuanFirst" style="width: 50%;text-align: center;line-height: 50px;border-right: 1px solid #eaeaea;">取消</div>
          <div @click="confirmDuihuanFirst" style="width: 50%;text-align: center;line-height: 50px;color: #f0a367;">确定</div>
        </div>
        <!-- <div class="duihuanPop-btn" v-if="!isNiuDuiLoadding" @click="duijifen">确定</div>
        <div class="duihuanPop-btn" v-if="isNiuDuiLoadding">确定</div> -->
      </div>
    </van-popup>
     <!-- 换牛二期-88-兑换二次确认弹窗 -->
     <van-popup v-model="duihuanSecondPop" position="center" :overlay="true" round :close-on-click-overlay="false">
      <div class="dui-pop2">
        <div style="width:100%;height: 89px;display: flex;align-items: center;padding: 0 30px;justify-content: center;">
            <span style="font-size: 16px;color: #333;font-weight: 500;">请核对ID{{niuUid}}是否正确</span>
        </div>
        <div class="" style="height: 50px;display: flex;width: 100%;border-top: 1px solid #eaeaea;">
          <div @click="cancelDuihuanSecond" style="width: 50%;text-align: center;line-height: 50px;border-right: 1px solid #eaeaea;">取消</div>
          <div @click="confirmDuihuanSecond" style="width: 50%;text-align: center;line-height: 50px;color: #f0a367;">确定</div>
        </div>
      </div>
    </van-popup>
    
  </div>
</template>
<script>
import memberBanlanceController from "./member_banlanceController_v2";
export default memberBanlanceController;
</script>
<style lang="scss" scoped>
.icon-balance_p {
  color: #f15353;
}
.icon-balance_a {
  color: #6cbf6a;
}

.icon-balance_b {
  color: #fac337;
}

.icon-balance_c {
  color: #069ce7;
}

.background_box {
  color: #382c0a;
  background-color: #fff;
  // background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
  // background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
  // background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
  background-image: linear-gradient(#00d576, #f5f5f5);
  min-height: 12.125rem;
  padding: 1.5938rem 1.0938rem 0 1.0938rem;
}
.background_box1 {
  color: #382c0a;
  background-color: #fff;
  background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
  background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
  background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
  min-height: 12.125rem;
  padding: 1.5938rem 1.0938rem 0 1.0938rem;
}
.contenbox {
  padding: 0 0.625rem;
  .dataStatistics {
    padding: 0.75rem;
    background: #fff;
    margin-top: 0.5rem;
    .title {
      font-weight: bold;
      font-size: 1rem;
      text-align: left;
      margin-bottom: 1.4375rem;
    }
    .navDateList {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 0.5rem;
      .lis {
        font-size: 0.75rem;
        line-height: 1.03rem;
        margin-right: 2rem;
        padding: 0.25rem 0.75rem;
      }
      .lis:last-child {
        margin-right: 0;
      }
      .isDay {
        border-radius: 0.78rem;
        background: var(--themeBaseColor);
        color: #ffffff;
      }
    }
    .list {
      height: 3rem;
      border-bottom: 1px solid #e7e7e7;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .left {
        width: 50%;
        font-size: 0.81rem;
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left;
      }
      .right {
        width: 50%;
        font-size: 0.81rem;
        font-weight: bold;
        color: #f20606;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: right;
      }
    }
    .list:last-child {
      border-bottom: none;
    }
  }
  .rests {
    min-height: 6.875rem;
    background: #ffffff;
    border-radius: 0.625rem;
    margin-top: 0.625rem;
    padding: 0.9688rem 0.9063rem;
    .title {
      font-weight: bold;
      font-size: 1rem;
      text-align: left;
      margin-bottom: 1.4375rem;
    }
    .lis {
      display: flex;
      flex-wrap: wrap;
      .restslis {
        width: 25%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .image_name {
          width: 2.75rem;
          height: 2.75rem;
          margin-bottom: 0.7188rem;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .image {
          width: 1.5938rem;
          height: 1.4688rem;
          margin-bottom: 0.7188rem;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .txt {
          width: 100%;
        }
      }
    }
  }
  .balanceDetail {
    margin-top: 0.625rem;
    border-radius: 0.625rem;
    background: #fff;
    padding: 0.9375rem 0.875rem;
    .balanceDetail_lis {
      border-bottom: 1px solid #f6f6f6;
      padding: 0.9375rem 0;
      .balanceDetail_lis_top,
      .balanceDetail_lis_bottom {
        display: flex;
        justify-content: space-between;
      }
      .balanceDetail_lis_bottom {
        margin-top: 0.625rem;
      }
      .balanceTxt {
        font-weight: 400;
        color: #666666;
        font-size: 0.6875rem;
      }
      .time {
        color: #999999;
        font-size: 0.6875rem;
      }
      .balanceDetail_lis_top_left {
        font-size: 0.8125rem;
        font-weight: 500;
      }
      .price {
        font-weight: 500;
        color: #f20606;
        font-size: 0.8125rem;
      }
    }
    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .title_left {
        font-size: 1rem;
        color: #333333;
        font-weight: bold;
      }
      .title_right {
        color: #878787;
        font-weight: 400;
        font-size: 0.6875rem;
        display: flex;
        align-items: center;
      }
    }
  }
  .detail {
    margin-top: -8rem;
    background: #ffffff;
    border-radius: 0.625rem;
    // min-height: 11.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1.4063rem 0.625rem 1.4063rem;
    .duihuan-niu {
      // width: 100%;
      border: 1px solid #b3b3b3;
      color: #262626;
      margin-right: 15px;
      padding: 0.625rem 1.0375rem;
      border-radius: 0.3125rem;
      font-size: 0.75rem;
      font-weight: 400;
    }
    .duihuan-bg {
      background: #fe9a51 !important;
      color: #fff !important;
      border: none !important;
    }
    .txt {
      font-size: 0.8125rem;
      color: #666666;
    }
    .balance {
      font-size: 1.375rem;
      font-weight: bold;
      color: #333333;
    }
    .activityTxt {
      width: 100%;
      text-align: left;
      font-weight: 400;
      color: #f20606;
      font-size: 0.625rem;
      margin-top: 0.9063rem;
      display: flex;
      flex-wrap: wrap;
    }
    .detailBox {
      display: flex;
      width: 100%;
      margin-top: 2.4rem;
      .detailBox_btn {
        padding: 0.625rem 1.9375rem;
        border-radius: 0.3125rem;
        font-size: 0.75rem;
        font-weight: 400;
      }
      .recharge {
        border: 1px solid var(--themeBaseColor);
        color: var(--themeBaseColor);
        margin-right: 15px;
      }
      .transfer {
        border: 1px solid #b3b3b3;
        color: #262626;
        margin-right: 15px;
      }
      .withdraw {
        background: var(--themeBaseColor);
        color: #fff;
        border-top: 1px solid var(--themeBaseColor);
        border-bottom: 1px solid var(--themeBaseColor);
      }
    }
  }
}
.justify-center {
  display: flex;
  justify-content: center;
}
// 换牛二期-88-兑换积分弹窗
.dui-pop {
  width: 280px;
  height: 200px;
  border-radius: 20px;
}
.duihuanPop-title {
  height: 60px;
  line-height: 60px;
  font-size: 17px;
  color: #333;
  font-weight: 600;
}
.duihuanPop-input {
  height: 74px;
  border: none;
  text-align: center;
  font-size: 26px;
  width: 100%;
  text-align: right;
}
.duihuanPop-input1 {
  height: 40px;
  border: 1px solid #eaeaea;
  border-radius: 10px;
  // padding-left: 6px;
  text-align: center;
  width: 180px;
}
.duihuanPop-btn {
  width: 200px;
  height: 40px;
  border-radius: 20px;
  background: #f0a367;
  color: #fff;
  line-height: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  margin: 0 auto;
}
// 兑换一次确定弹窗
.dui-pop1 {
  width: 280px;
  height: 170px;
  border-radius: 20px;
}
// 兑换二次确定弹窗
.dui-pop2 {
  width: 280px;
  height: 140px;
  border-radius: 20px;
}
</style>
